package com.satan.fmmall.controller;

import com.satan.fmmall.entity.UserAddr;
import com.satan.fmmall.service.UserAddrService;
import com.satan.fmmall.vo.ResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ClassName UserAddrController
 * @Description TODO
 * @date 2022/4/15 20:28
 * @Version 1.0
 */
@RestController
@RequestMapping("/useraddr")
@Api(tags = "收货地址管理接口",value = "提供收货地址相关接口")
public class UserAddrController {
    @Resource
    private UserAddrService userAddrService;
    @ApiOperation("查询用户收货地址列表接口")
    @GetMapping("/list")
    public ResultVo listAddr(Integer userId){
        return userAddrService.listAddrsByUserId(userId);
    }
    @ApiOperation("删除用户收货地址列表接口")
    @DeleteMapping("/delete")
    public ResultVo deleteAddr(String addrId){
        return userAddrService.deleteAddrByAddrId(addrId);
    }

    @ApiOperation("添加用户收货地址列表接口")
    @PostMapping("/add")
    public ResultVo addAddr(Integer addrId){

        return null;
    }

    @ApiOperation("添加或修改用户收货地址列表接口")
    @PostMapping("/update")
    public ResultVo updateAddr(@RequestBody UserAddr userAddr){
        return userAddrService.updateAddrByEntity(userAddr);
    }

}
